<template>
	<view class="home_box">
		<view class="home_banner">
			<image src="https://iflytts.oss-cn-qingdao.aliyuncs.com/wxapp/aixz/wayu/nwork44.png" mode=""></image>
			<!-- <image src="https://iflytts.oss-cn-qingdao.aliyuncs.com/qrCode/dyskefu.jpg" mode="widthFix"></image> -->
		</view>
		<!-- 悬浮拖动按钮 -->
		<!-- <liu-drag-button @clickBtn="clickBtn" v-if="navback">按钮</liu-drag-button> -->
		<view class="home_tools">
			<view class="tools_left" @click="goSmartSecretary">

				<text class="left_title">文案生成器</text>
				<image src="https://iflytts.oss-cn-qingdao.aliyuncs.com/wxapp/aixz/wayu/nwork43.png" mode="widthFix"
					style="height:104rpx;width:104rpx;"></image>
			</view>
			<view class="tools_right">
				<view class="right_top">
					<view class="top_left" @click="goAiWriting">
						<image src="../../static/fish/b-2.png" mode="widthFix" style="height: 50rpx;width: 50rpx;">
						</image>
						<text class="right_title">文案改写</text>
					</view>
					<view class="top_right" @click="goTextSoundh">
						<image src="../../static/fish/b-4.png" mode="widthFix" style="height: 50rpx;width: 50rpx;">
						</image>
						<text class="right_title">文案扩写</text>
					</view>
				</view>
				<view class="right_down">
					<view class="down_left" @click="goCopywritingExtraction">
						<image src="../../static/fish/b-3.png" mode="widthFix" style="height: 50rpx;width: 50rpx;">
						</image>
						<text class="right_title">文案提取</text>
					</view>
					<view class="down_right" @click="clickBtn">
						<image src="../../static/fish/b-1.png" mode="widthFix" style="height: 50rpx;width: 50rpx;">
						</image>
						<text class="right_title">视频文案</text>
					</view>
				</view>
			</view>
		</view>
		<view class="home_writing">
			<text>热门写作</text>
			<!-- 	<img src="/static/fish/ju_long.png" alt=""> -->
			<!-- <view style="width: 41rpx;height: 5rpx;background-color: #379AFF;"></view> -->
			<!-- <u-line color="#E2E2E2" /> -->
		</view>
		<view class="home_otherTools">
			<u-grid :border="false" col="2">
				<u-grid-item v-for="(tiem, index) in otherTools" :key="index" @click="goOtherTools(tiem)" :custom-style="{padding: '20rpx',
          background: '#FFFCFC',
          width: '335rpx', 
          height: '162rpx',
          'border-radius': '22rpx 22rpx 22rpx 22rpx',
          'margin-bottom':'20rpx',
          'margin-left': index % 2 === 1 ? '30rpx' : '10rpx',
          display:'flex','justify-content': 'space-between','align-items': 'center',
          }">
					<text class="otherTools_title">{{ tiem.title }}</text>
					<text class="otherTools_titles">{{ tiem.text }}</text>
					<u-icon :custom-style="{ width: '81rpx', height: '56rpx',position:'absolute',bottom:'0',right:'0',}"
						:name="tiem.image" :size="65">
					</u-icon>
				</u-grid-item>
			</u-grid>
		</view>
		<!-- 	<view style="width: 100%;height: 20rpx;background-color: #f4f4f4;"></view> -->
		<!-- 		<u-popup :show="statementShows" mode="center" @close="close" :closeable="false" :closeOnClickOverlay="false"
			round="14">
			<view class="statementboxs">
				<view class="statements">
					<image src="../../static/fish/nosay.png" mode=""></image>
				</view>
				<view class="statemens">
					<image src="../../static/fish/jyla.jpg" mode=""></image>
				</view>
				<view class="statementtexts">
					你的账号存在违规,请联系客服解封
					如以解封，请删除重进，有五分钟缓冲时间
				</view>
				<view class="surebtnstyles">
					<view class="surebtn" @click="closer">
						联系客服
					</view>
				</view>
			</view>
		</u-popup> -->

		<!-- #ifdef MP-WEIXIN -->
		<jade-mp-privacy initiative></jade-mp-privacy>
		<!-- #endif -->
	</view>
</template>

<script>
	import {
		vipType,
		isLogin
	} from '../../business/login.js'
	import {
		apiMixUrlApi
	} from '@/api/assemb.js'
	import {
		getInfo
	} from "@/business/systeminfo.js";
	import {
		grayControl,
	} from '@/utils/grayControl.js'
	import store from '@/store/idnex.js'
	export default {
		data() {
			return {
				navback: false,
				statementShow: false,
				statementShows: false,
				otherTools: [{
						image: '/static/fish/AIxz.png',
						title: 'AI写作',
						text: '一键生成文案',
						urls: '/pages_aiTools/creation/creation'
					},
					{
						image: '/static/fish/waxx.png',
						text: '续写精彩文章',
						title: '文案续写',
						urls: '/pages_aiTools/sevetitle/sevetitle'
					},
					{
						image: '/static/fish/jasj.png',
						text: '教学文案',
						title: '教案设计',
						urls: '/pages_create/student/student'
					},


					{
						image: '/static/fish/hpwa.png',
						text: '写一篇精彩的武侠小说',
						title: '小说写手',
						urls: '/pages_create/fiction/fiction',

					},
					{
						image: '/static/fish/video.png',
						text: '一键生成带货金句',
						title: '短视频文案',
						urls: '/pages_create/video/video',
					},
					{
						image: '/static/fish/years.png',

						title: '演讲稿件',
						text: '拯救社恐人群',
						id: 161,
						tab: 3,
						zt: '演讲主题',
						content: '关爱空巢老人',
					},



					{
						image: '/static/fish/video_hot.png',
						title: '影视解说',
						text: '各种影视解说文案',
						urls: '/pages/tools/toolr',
					},
					// {
					// 	image: '/static/fish/home_gjwyc2.png'
					// 	title: '高级伪原创'
					// },
					{
						image: '/static/fish/xhs.png',
						text: '小红书种草文案',
						title: '小红书',
						urls: '/pages_create/redBookWriting/redBookWriting',
					},
					{
						image: '/static/fish/qwxz.png',
						text: '一键生成新媒体文章',
						title: '全文写作',
						urls: '/pages_create/newMedia/newMedia',

					},


					{
						image: '/static/fish/year.png',
						title: '年终总结',
						text: '专属于你的年度报告',
						urls: '/pages_otherTools/yearwork/yearwork'
					},
					{
						image: '/static/fish/xhszc.png',
						title: '学生作文',
						text: '一键生成精彩作文',
						urls: '/pages_aiTools/studentComposition/studentComposition',

					},
					{
						image: '/static/fish/rb.png',
						text: '生成日报，周报，月报',
						title: '日报/周报/月报',
						urls: '/pages_create/reports/reports',
					},
				]
			};
		},
		onLoad(options) {
			if(uni.getStorageSync('baseinfopro').apiVersion == 2){
				getInfo()
			}
		},
		onShow() {
			this.getFrequency()

			if (isLogin()) {
				grayControl()
			}
		},
		onShareAppMessage: function(res) {
			const that = this
			let userid = uni.getStorageSync('baseinfo').userid
			if (res.from === 'button') { // 来自页面内分享按钮
				console.log(res.target, 'res.target')
			}
			return {
				title: 'AI写作神器，一键改写变原创。',
				path: "pages/home/home?userid=" + userid,
				imageUrl: "https://iflytts.oss-cn-qingdao.aliyuncs.com/wxapp/xze/6.png",
				success: function(res) {
					console.log(
						"--------------转发成功--------------------",
						res,
						userid
					);
				}
			}
		},
		onShareTimeline: function(res) {},
		methods: {
			getFrequency() {
				apiMixUrlApi({}, 1042, 'GetPaymentInfo').then(data => {
					if (data.descinfo == "success") {
						console.log(data.coins,'---------------------')
						uni.setStorageSync('frequencyrs', data.coins)
					}
				});
			},
			clickBtn() {
				uni.navigateTo({
					url: '/pages_create/video/video',
				})
			},
			//点击跳转客服
			closer() {
				uni.navigateTo({
					url: '/pages/service/service'
				})
			},
			//点击确定关闭背景图
			close() { //往本地存一个值
				uni.setStorageSync("statement", true);
				this.statementShow = false;
			},
			toPay() {
				if (uni.getStorageSync('OS') !== 'ios') {
					uni.navigateTo({
						url: '../paymentCenter/paymentCenter'
					});
				} else {
					if (getApp().globalData.iosPay == 0) {
						uni.showModal({
							title: '提示',
							content: '由于相关规范，IOS功能暂不可用',
							showCancel: false,
							success: function(res) {
								if (res.confirm) {
									console.log('用户点击确定');
								} else if (res.cancel) {
									console.log('用户点击取消');
								}
							}
						});
					} else if (getApp().globalData.iosPay == 1) {
						uni.navigateTo({
							url: '/pages/goods/goods'
						});
					}
				}
			},
			/*
			 *	@	跳转文案提取
			 */
			goCopywritingExtraction() {
				uni.navigateTo({
					url: '/pages_aiTools/copywritingExtraction/copywritingExtraction'
				});
			},
			/*
			 *	@	跳转去除水印
			 */
			goAudioJoiningVideos() {
				uni.navigateTo({
					url: '/pages_otherTools/audioJoiningVideos/audioJoiningVideos'
				});
			},
			/*
			 *	@	跳转文字转语音
			 */
			goTextToSpeech() {
				if (uni.getStorageSync("jumpParameter")) {
					uni.navigateBackMiniProgram({
						extraData: {

						},
						success(res) {
							// 返回成功
						}
					})
				} else {
					uni.navigateToMiniProgram({
						appId: 'wx7aa29052a47a142f', // appid
						path: 'pages/index/index', // 首页路径
						envVersion: "release",
						success: res => {
							// 打开成功
							console.log("打开成功", res);
						},
						fail: err => {
							console.log(err);
						}
					})
				}
			},
			goSecretary() {
				uni.navigateTo({
					// url: '/pages_aiTools/secretary/secretary'
					url: '/pages_aiTools/creation/creation'
				});
			},
			/*
			 *	@	跳转AI写作
			 */
			goAiWriting() {
				uni.navigateTo({
					url: '/pages_aiTools/aiWriting/aiWriting'
				});
			},
			goWatermark() {
				uni.navigateTo({
					url: '/pages_otherTools/audioJoiningVideos/audioJoiningVideos'
				});
			},
			goTextSoundh() {
				uni.navigateTo({
					url: '/pages_aiTools/labtitle/labtitle'
				});
			},
			goPc() {
				uni.navigateTo({
					url: '/pages/copute/copute'
				});
			},
			goSmartSecretary() {
				uni.navigateTo({
					url: '/pages_aiTools/creation/creation'
				});
			},
			/*
			 *	@
			 */
			goOtherTools(name) {
				if (name.urls) {
					uni.navigateTo({
						url: name.urls
					});
				} else {
					uni.navigateTo({
						url: '/pages_otherTools/peoper/peoper?title=' + name.zt + '&footer=' + name
							.title + '&id=' + name.id + '&content=' + name.content,
					})
				}

			}
		}
	};
</script>

<style lang="scss" scoped>
	/deep/.swiper-item_box {
		height: 257.85rpx;
	}

	.statementboxs {
		width: 620rpx;
		// height: 572rpx;

		.statements {
			display: flex;
			justify-content: center;
			margin-top: 50rpx;

			image {
				width: 114rpx;
				height: 114rpx;
			}
		}

		.statemens {
			display: flex;
			justify-content: center;
			margin-top: 50rpx;

			image {
				width: 220rpx;
				height: 66rpx;
			}
		}

		.statementtexts {
			// margin-left: 300rpx;
			font-size: 26rpx;
			margin-top: 60rpx;
			font-family: PingFang SC;
			font-weight: 500;
			color: #333333;
			margin: 0 115rpx;
			margin-top: 58rpx;
			margin-bottom: 48rpx;
		}

		.surebtnstyles {
			display: flex;
			justify-content: center;

			.surebtn {
				display: flex;
				justify-content: center;
				align-items: center;
				font-size: 34rpx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #ffffff;
				width: 440rpx;
				height: 117rpx;
				background-repeat: no-repeat;
				background-size: cover;
				background-image: url("https://mysmallapp.oss-cn-shanghai.aliyuncs.com/aixz/img/xzybg.png");
			}
		}
	}

	.statementbox {
		width: 620rpx;
		height: 572rpx;

		.statement {
			display: flex;
			justify-content: center;
			margin-top: 50rpx;

			image {
				width: 114rpx;
				height: 55rpx;
			}
		}

		.statementtext {
			font-size: 25rpx;
			margin-top: 60rpx;
			font-family: PingFang SC;
			font-weight: 500;
			color: #333333;
			margin: 0 70rpx;
			margin-top: 58rpx;
			margin-bottom: 48rpx;
		}

		.surebtnstyle {
			display: flex;
			justify-content: center;

			.surebtn {
				display: flex;
				justify-content: center;
				align-items: center;
				font-size: 34rpx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #ffffff;
				width: 440rpx;
				height: 117rpx;
				background-repeat: no-repeat;
				background-size: cover;
				background-image: url("https://mysmallapp.oss-cn-shanghai.aliyuncs.com/aixz/img/xzybg.png");
			}
		}
	}

	.home_box {
		height: 100%;
		background-color: #f8f8f8;

		.home_banner {
			// padding-top: 180rpx;
			width: 710rpx;
			height: 240rpx;
			margin-left: 25rpx;

			image {
				width: 99%;
				height: 100%;
				// top: 7%;
				// position: absolute;
			}

			// background-repeat: no-repeat;
			// background-size: cover;
			// background-image: url("https://iflytts.oss-cn-qingdao.aliyuncs.com/website/img/aixz/create/bann.png");

			.banner {
				width: 706.52rpx;
				height: 257.85rpx;
				margin: auto;

				.banner_image {
					width: 100%;
					height: 257.85rpx !important;

					image {
						width: 706.52rpx;
						height: 257.85rpx;
					}
				}
			}
		}

		.home_tools {
			display: flex;
			justify-content: space-between;
			padding: 0 26rpx 0 26rpx;
			position: relative;
			margin-top: 20rpx;

			.home_ts {
				width: 100rpx;
				height: 100rpx;
				position: absolute;
				bottom: -100rpx;
				left: 630rpx;
			}

			.tools_left {
				align-items: center;
				display: flex;
				flex-direction: column;
				justify-content: center;
				width: 234rpx;
				height: 232rpx;
				background: #FCE8ED;
				opacity: 1;
				border-radius: 18rpx;

				//   background-color: #6799ff;
				image {
					margin-top: 15rpx !important;
					margin-left: 0 !important;
				}


				.left_title {
					color: #ffffff;
					font-size: 32rpx;
					font-family: PingFang SC-Bold, PingFang SC;
					// font-weight: bold;
					color: #332F2F;
				}

				.left_text {
					margin-left: 25rpx;
					font-size: 22rpx;
					color: #dfeaff;
				}

				image {
					margin-left: 40rpx;
					margin-top: 31rpx;
					width: 149rpx;
					height: 131rpx;
				}
			}

			.tools_right {
				margin-top: 3rpx;
				display: flex;
				flex-direction: column;
				// justify-content: space-between;

				.right_top {
					display: flex;
					// flex-direction: column;
					justify-content: center;
					// width: 458rpx;
					// height: 135rpx;
					// background: #f0f5ff;
					// border-radius: 12rpx;
					// display: flex;
					justify-content: space-between;

					.top_left {
						display: flex;
						justify-content: center;
						align-items: center;
						width: 220rpx;
						height: 108rpx;
						//   background: #ffffff;
						border-radius: 12rpx;
						margin-right: 15rpx;
						background-repeat: no-repeat;
						background-size: cover;
						background: #D3FFCC;
						// border-bottom: 5px solid gray;  


						// background-image: url("https://iflytts.oss-cn-qingdao.aliyuncs.com/wxapp/aixz/wagx.png");
					}

					.top_right {
						display: flex;
						align-items: center;
						justify-content: center;
						width: 220rpx;
						height: 108rpx;
						//   background: #ffffff;
						border-radius: 12rpx;
						background-repeat: no-repeat;
						background-size: cover;
						background: #FFE2E2;


						// background-image: url("https://iflytts.oss-cn-qingdao.aliyuncs.com/wxapp/aixz/wakx.png");
					}
				}

				.right_down {
					margin-top: 12rpx;
					display: flex;
					justify-content: space-between;

					.down_left {
						display: flex;
						align-items: center;
						justify-content: center;
						width: 220rpx;
						height: 108rpx;
						//   background: #ffffff;
						border-radius: 12rpx;
						background-repeat: no-repeat;
						background-size: cover;
						background: #E5F2FF;


						// background-image: url("https://iflytts.oss-cn-qingdao.aliyuncs.com/wxapp/aixz/watq.png");
					}

					.down_right {
						display: flex;
						align-items: center;
						justify-content: center;
						width: 220rpx;
						height: 108rpx;
						//   background: #ffffff;
						border-radius: 12rpx;
						background-repeat: no-repeat;
						background-size: cover;
						background: #DCE4FF;


						// background-image: url("https://iflytts.oss-cn-qingdao.aliyuncs.com/wxapp/aixz/pc.png");
					}
				}
			}
		}

		.right_title {
			margin-left: 13rpx;
			font-size: 26rpx;
			font-family: PingFang SC, PingFang SC;
			font-weight: 400;
			color: #332F2F;
			line-height: 0rpx;
		}

		.right_text {
			margin-left: 34rpx;
			font-size: 22rpx;
			font-family: PingFang SC;
			color: #4e4e4e;
		}

		.home_writing {
			width: 100%;
			height: 50rpx;
			font-size: 36rpx;
			font-family: PingFang SC-Bold, PingFang SC;
			font-weight: bold;
			color: #332f2f;
			padding: 0 42rpx;
			box-sizing: border-box;
			margin-top: 46rpx;
			margin-bottom: 20rpx;

			image {
				width: 144rpx;
				height: 12rpx;
				border-radius: 4rpx;
				position: absolute;
				left: 40rpx;
				/* top: 72rpx; */
				margin-top: 40rpx;
			}
		}

		.home_otherTools {
			padding: 10rpx 20rpx;

			.otherTools_title {
				position: absolute;
				left: 30rpx;
				top: 32rpx;
				padding-bottom: 20rpx;
				font-size: 25rpx;
				font-family: PingFang SC;
				color: #333333;
				line-height: 26rpx;
				font-family: PingFang SC, PingFang SC;
				font-weight: bold;
			}

			.otherTools_titles {

				position: absolute;
				left: 30rpx;
				top: 80rpx;
				padding-bottom: 20rpx;
				line-height: 26rpx;
				font-size: 20rpx;
				font-family: PingFang SC-Regular, PingFang SC;
				font-weight: 400;
				color: #828282;
			}
		}
	}
</style>